package com.x.springboot.util;

import java.util.UUID;

public class UuidUtil {
    private static UuidUtil uuidUtil;

    public UuidUtil() {
    }

    public static UuidUtil getUuidUtilImpl() {
        if (uuidUtil == null) {
            uuidUtil = new UuidUtil();
        }

        return uuidUtil;
    }

    public static String[] getUUID(int number) {
        if (number < 1) {
            return null;
        } else {
            String[] retArray = new String[number];

            for(int i = 0; i < number; ++i) {
                retArray[i] = getUUID();
            }

            return retArray;
        }
    }

    public static String getUUID() {
        String uuid = UUID.randomUUID().toString();
        return uuid.replaceAll("-", "").toLowerCase();
    }
}